package com.lantosec.hmrp.modules.warning.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.warning.vo.WarningLogVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * <p>
 *  实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-06-09
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WarningLog extends BaseEntity<WarningLogVO> {

    private static final long serialVersionUID = 1L;
    public WarningLog(WarningLogVO vo){
        this.id = vo.getId();
        this.ruleId = vo.getRuleId();
        this.startTime = vo.getStartTime();
        this.endTime = vo.getEndTime();
        this.dataNum = vo.getDataNum();
        this.nextRunTime = vo.getNextRunTime();
        this.mistiming = vo.getMistiming();
        this.ruleName = vo.getRuleName();
    }

    @Override
    public WarningLogVO convertToVO(){
        return new WarningLogVO(this);
    }


    /**
     * 主键ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    /**
     * 预警规则ID
     */
    private String ruleId;

    /**
     * 预警规则ID
     */
    @TableField(exist = false)
    private String ruleName;

    /**
     * 预警规则运行开始时间
     */
    private String startTime;

    /**
     * 预警规则运行结束时间
     */
    private String endTime;

    /**
     * 预警记录数
     */
    private Integer dataNum;

    /**
     * 下次运行时间
     */
    private String nextRunTime;
    
    /**
     * 运行时长
     */
    @TableField(exist = false)
    private String mistiming;


    public enum ColName {
        id, rule_id, start_time, end_time, data_num, next_run_time, 
    }
}
